package com.dc.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "common")
public class CommonConfig {

    /** 上传路径 */
    @Getter
    private static String profile;

    @Getter
    @Value("${common.plateform.host}")
    public String host;         // http请求的地址

    @Getter
    @Value("${common.plateform.username}")
    public String username;

    @Getter
    @Value("${common.plateform.password}")
    public String password;

    public void setProfile(String profile)
    {
        CommonConfig.profile = profile;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }



    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }

    /**
     * 获取船照片上传路径
     */
    public static String getShipPicPath() {
        return getProfile() + "/ship_pic";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }


}
